<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <script>
        /* 
        先请求a,再请求b,再请求c
        */
       function* getdata(){
        console.log('请求a');
        yield setTimeout(() => {
            console.log('a数据');
            p1.next()
        }, 2000);
        console.log('请求b');
        yield setTimeout(() => {
            console.log('b数据');
            p1.next()
        }, 2000);
        console.log('请求c');
        yield setTimeout(() => {
            console.log('c数据');
        }, 2000);
       }
       const p1=getdata()
       p1.next()
    </script>
</body>
</html>